全部文档

7.2LWM2M命令管理

功能意义:命令下发会指定某台LWM2M设备,并对此设备的指定属性进行异步读写。

7.2.1添加LWM2M离线命令

功能描述:添加LWM2M离线命令。

POST  /api/v1/offlinecmds/nb

Body:

Name Type Description Required
type int 命令类型(1-write, 2-execute) 不支持读 Yes
imei string LWM2M设备的身份码 Yes
identifier string 设备的属性标识符 Yes
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线) Yes
validTime long 命令开始生效时间,大于当前时间,单位:毫秒 Yes
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒 Yes
content string 命令的内容,命令类型为write/execute时必须 No

Body example:

{
    "type":1,
    "imei":"123456789876",
    "identifier":"_3311_0_5852",
    "retry":5,
    "expiredTime":1585472875000,
    "validTime":1585172875000,
    "content":"test"
}

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "type":0,
                "imei": "123456",
                "identifier": "123123",
                "retry": 3,
                "validTime": "1554862042000",
                "expiredTime": "1554862042555"
            }'

Response data:

Name Type Description
commandId string 命令ID

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":{
        "commandId": "123"
    }
}

7.2.2查询LWM2M单个离线命令

功能描述:查询LWM2M离线命令。

GET  /api/v1/offlinecmds/nb/{commandId}

Path:

Name Type Description Required
commandId int 命令ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/5caaf54ae1382315d9c69c63?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
commandId string 命令ID
createTime long 创建命令的时间
sendTime long 发送命令的时间
sendStatus int 命令状态0:等待;
1:命令被取消;
2:命令已发送;
3:命令过期;
4:命令执行成功;
5:命令执行失败;
6:命令超时;
cmdResult string 命令响应内容
failedCount int 命令执行失败次数
type int 命令类型(0-read, 1-write, 2-execute)
imei string LWM2M设备的身份码
identifier string 设备的属性标识符
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线)
validTime long 命令开始生效时间,大于当前时间,单位:毫秒
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒
content string 命令的内容,命令类型为write/execute时必须

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":{
            "commandId": "5cac36aee13823f52253556a",
            "type": 1,
            "imei": "123",
            "identifier":"_3311_0_5852",
            "retry": 3,
            "mode": 0,
            "content": "{\n\n}",
            "createTime": 1554790062302,
            "validTime": 1554862042000,
            "expiredTime": 1554862042555,
            "sendTime": 0,
            "sendStatus": 0,
            "cmdResult": "",
            "failedCount": 0
     }
}

7.2.3分页查询LWM2M离线命令

功能描述:分页查询LWM2M离线命令。

GET  /api/v1/offlinecmds/nb/page

Query:

Name Type Description Required
start long 起始时间戳(毫秒),""表示起始时间无限制 No
end long 结束时间戳(毫秒),""表示起始时间无限制 No
imei string LWM2M设备的身份码 Yes
currentPage int 请求页码 Yes
pageSize int 每页数量 Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/page?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&currentPage=1&pageSize=1&imei=cewvee' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 当前页码
pageSize int 每页条数
totalCount long 总条数
totalPage int 总页数
content struct[] 当前页内容

Response data content的子对象结构体:

Name Type Description
commandId string 命令ID
createTime long 创建命令的时间
sendTime long 发送命令的时间
sendStatus int 命令状态 0:等待;
1:命令被取消;
2:命令已发送;
3:命令过期;
4:命令执行成功;
5:命令执行失败;
6:命令超时
cmdResult string 命令响应内容
failedCount int 命令执行失败次数
type int 命令类型(0-read, 1-write, 2-execute)
imei string LWM2M设备的身份码
identifier string 设备的属性标识符
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线)
validTime long 命令开始生效时间,大于当前时间,单位:毫秒
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒
content string 命令的内容,命令类型为write/execute时必须

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":{
    "content": [
            {
            "commandId": "5cac36aee13823f52253556a",
            "type": 1,
            "imei": "123",
            "identifier":"_3311_0_5852",
            "retry": 3,
            "mode": 0,
            "content": "{\n\n}",
            "createTime": 1554790062302,
            "validTime": 1554862042000,
            "expiredTime": 1554862042000,
            "sendTime": 0,
            "sendStatus": 0,
            "cmdResult": "",
            "failedCount": 0
            }
        ],
    "currentPage": 1,
    "pageSize": 1,
    "totalCount": 10,
    "totalPage": 10
    }
}

7.2.4查询LWM2M设备所有离线命令

功能描述:查询LWM2M设备所有离线命令。

GET  /api/v1/offlinecmds/nb/list

Query:

Name Type Description Required
imei string LWM2M设备的身份码 Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/list?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&imei=cewvee' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
commandId string 命令ID
createTime long 创建命令的时间
sendTime long 发送命令的时间
sendStatus int 命令状态0:等待;
1:命令被取消;
2:命令已发送;
3:命令过期;
4:命令执行成功;
5:命令执行失败;
6:命令超时
cmdResult string 命令响应内容
failedCount int 命令执行失败次数
type int 命令类型(0-read, 1-write, 2-execute)
imei string LWM2M设备的身份码
identifier string 设备的属性标识符
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线)
validTime long 命令开始生效时间,大于当前时间,单位:毫秒
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒
content string 命令的内容,命令类型为write/execute时必须

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":[
            {
            "commandId": "5cac36aee13823f52253556a",
            "type": 1,
            "imei": "123",
            "identifier":"_3311_0_5852",
            "retry": 3,
            "mode": 0,
            "content": "{\n\n}",
            "createTime": 1554790062302,
            "validTime": 1554862042000,
            "expiredTime": 1554862042000,
            "sendTime": 0,
            "sendStatus": 0,
            "cmdResult": "",
            "failedCount": 0
            }
      ]
}

7.2.5批量删除LWM2M设备离线命令

功能描述:批量删除LWM2M设备离线命令。

DELETE  /api/v1/offlinecmds/nb/list

Query:

Name Type Description Required
commandId string[] 命令ID的数组 Yes

cURL example:

curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/list?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&commandId=123,456' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":null
}

7.2.6多条件查询LWM2M离线命令

功能描述:多条件查询LWM2M离线命令。

GET  /api/v1/offlinecmds/nb/filter

Body:

Name Type Description Required
currentTime long 当前时间 Yes
imeiList string[] LWM2M设备的身份码的数组 Yes
statusList int[] 命令状态列表 Yes

Body example:

{
    "currentTime":1554862042000,
    "imeiList": [
                    "8ae48daf7163309a0171ee0575150010"
                  ],
    "statusList": [0,1]
}

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/filter?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&imei=cewvee' \
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
commandId string 命令ID
createTime long 创建命令的时间
sendTime long 发送命令的时间
sendStatus int 命令状态0:等待;
1:命令被取消;
2:命令已发送;
3:命令过期;
4:命令执行成功;
5:命令执行失败;
6:命令超时
cmdResult string 命令响应内容
failedCount int 命令执行失败次数
type int 命令类型(0-read, 1-write, 2-execute)
imei string LWM2M设备的身份码
identifier string 设备的属性标识符
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线)
validTime long 命令开始生效时间,大于当前时间,单位:毫秒
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒
content string 命令的内容,命令类型为write/execute时必须

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":[
            {
            "commandId": "5cac36aee13823f52253556a",
            "type": 1,
            "imei": "123",
            "identifier":"_3311_0_5852",
            "retry": 3,
            "mode": 0,
            "content": "{\n\n}",
            "createTime": 1554790062302,
            "validTime": 1554862042000,
            "expiredTime": 1554862042000,
            "sendTime": 0,
            "sendStatus": 0,
            "cmdResult": "",
            "failedCount": 0
            }
        ]
}

7.2.7更新LWM2M离线命令

功能描述:更新LWM2M离线命令。

PUT  /api/v1/offlinecmds/nb

Body:

Name Type Description Required
commandId string 命令ID Yes
retry int [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线) No
validTime long 命令开始生效时间,大于当前时间,单位:毫秒 No
expiredTime long 命令过期时间,必填且大于validTime,单位:毫秒 No
content string 命令的内容,命令类型为write/execute时必须 No

Body example:

{
        "commandId": "5cac3699e13823f48566d52a",
        "retry": 3,
        "content": "{\n\n}",
        "validTime": 1554862042000,
        "expiredTime": 1554862042000
}

cURL example:

curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                    "commandId": "5cac3699e13823f48566d52a",
                    "retry": 3,
                    "content": "{\n\n}",
                    "validTime": 1554862042000,
                    "expiredTime": 1554862042000
            }'

Response data:

Name Type Description
commandId String 命令ID

Response example:

{
    "code":0,
    "message":null,
    "success":true,
    "data":{"commandId":"5cac3699e13823f48566d52a"}
}

7.2.8LWM2M设备通过deviceId异步下发读取/写入命令

功能描述:LWM2M设备异步下发命令读取/写入功能点属性信息

POST /api/v1/commands-async/lwm2m

Body:

Name Type Description Required
deviceId int 设备ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需 No
mode int 替换(1,默认)/更新标志(2) No
timeout int 自定义超时时间 No

Body example:

{
    "deviceId":10086,
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/lwm2m?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "deviceId":10086,
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId String 命令ID

Response

{
    "code":0,
    "message":"",
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

7.2.9LWM2M设备通过productId + deviceName异步下发读取/写入命令

功能描述:设备异步下发命令读取/写入功能点属性信息

POST /api/v1/device/command/byname/async

Body:

Name Type Description Required
productId int 产品ID Yes
deviceName string 设备名称 Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需 No
mode int 替换(1,默认)/更新标志(2) No
timeout int 自定义超时时间 No

Body example:

{
    "productId":10086,
    "deviceName": "test",
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/command/byname/async?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "productId":10086,
                "deviceName": "test",
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId String 命令ID

Response

{
    "code":0,
    "message":"",
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

7.2.10 【nb设备离线服务调用】 添加nb离线服务调用

功能描述:添加离线服务调用

POST /api/v1/offlineservice/nb"

Body:

Name Type Description Required
imei string nbiot设备的身份码 Yes
serviceName string 服务名 Yes
retry Integer 重试次数 3-10]之间,表示失败重试次数 Yes
expiredTime Long 命令过期时间戳 毫秒 Yes
validTime Long 命令有效时间戳 毫秒 Yes
input Map 服务调用入参内容 No key为参数名,value为参数值 No

Body example:

{
    "imei": "868474044790978",
    "serviceName": "RemoteOpenDoorSvc",
    "retry": 5,
    "expiredTime": 1620643306000,
    "validTime": 1618296906595,
    "input": {
        "Operation": 1
    }
}

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb?accessKeyId=4EKha46hV011SHAu&signature=xx&signatureNonce=x&currentPage=1&pageSize=100' \
--header 'platform: 1' \
--header 'projectId: 559a2be0-aaaa-46a4-91c4-06dc7f6d39a1' \
--header 'Content-Type: application/json' \
--data-raw '{
    "imei": "868474044790978",
    "serviceName": "RemoteOpenDoorSvc",
    "retry": 5,
    "expiredTime": 1620643306000,
    "validTime": 1618296906595,
    "input": {
        "Operation": 1
    }
}'

Response data:

Name Type Description
serviceId String 服务id

Response

{
    "code": 0,
    "data": {
        "serviceId": "8237e440-530c-41a1-b39f-e45bf5df0e29"
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

7.2.11 【nb设备离线服务调用】 根据服务id获取离线服务调用

功能描述:根据服务id获取离线服务调用

GET /api/v1/offlineservice/nb/{serviceId}"

Path:

Name Type Description Required
serviceId string 服务id Yes
**cURL example:**

curl --location --request GET {URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb/b974e606-4d7f-4bc4-ac56-772f68885e7e?accessKeyId=4EKha46hV011SHAu&signature=xx&signatureNonce=x&pageSize=100' \ --header 'platform: 1' \ --header 'projectId: 559a2be0-aaaa-46a4-91c4-06dc7f6d39a1'


**Response data:**
Response    
| Name        | Type     | Description |
| ----------- | -------- | ----------- |
| serviceId   | String   | 服务id      |
| imei   | string   | nbiot设备的身份码      |
| type   |  int32  | 服务类型    1:同步 2:异步      |
| serviceName   | String   | 服务名      |
| retry   | int32   | 重试次数      |
| input   | map[string]interface{}   | 服务入参      |
| output   | map[string]interface{}   | 服务出参      |
| expiredTime   | int64   | 过期时间戳      |
| validTime   | int64   | 有效时间戳      |
| sendTime   | int64   | 发送时间      |
| createTime   | int64   | 创建时间      |
| sendStatus   | int32   | 服务调用状态     0: 等待; 1:被取消;2:已发送; 3:过期;4:执行成功; 5:执行失败; 6:超时; |
| failedCount   | int32   | 执行失败次数      |
| errMsg   | string   | 错误信息      |


**Response**

{ "code": 0, "data": { "errMsg": "", "type": 1, "serviceName": "RemoteOpenDoorSvc", "expiredTime": 1620643306000, "sendTime": 0, "output": null, "input": { "Operation": 1 }, "failedCount": 0, "createTime": 1618454160708, "imei": "868474044790978", "validTime": 1618296906595, "sendStatus": 0, "serviceId": "5e7c1abb-3172-4a70-90e5-e9da753cf235", "retry": 5 }, "msg": "成功", "referInfo": null, "success": true }


## 7.2.12  【nb设备离线服务调用】 根据设备imei分页获取指定时间区间的服务调用列表

功能描述:根据设备imei分页获取指定时间区间的服务调用列表

Get /api/v1/offlineservice/nb/page

**Query:**

|    Name     |  Type  | Description                      | Required |
| :---------: | :----: | :------------------------------- | -------- |
|    start    |  long  | 起始时间戳(毫秒),-1: 表示起始时间无限制 | Yes      |
|     end     |  long  | 结束时间戳(毫秒),-1: 表示结束时间无限制 | Yes      |
|    imei     | string | nbiot设备的身份码                    | Yes      |
| currentPage |  int   | 请求页码                         | Yes      |
|  pageSize   |  int   | 每页数量                         | Yes      |

cURL example:

curl --location --request  GET {URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb/page?accessKeyId=4EKha46hV011SHAu&signature=xx&signatureNonce=x&currentPage=1&pageSize=100&imei=868474044790978&start=1618422024000&end=1618454424000' \
--header 'platform: 1' \
--header 'projectId: 559a2be0-aaaa-46a4-91c4-06dc7f6d39a1'

Response data: Response
| Name | Type | Description | | ----------- | -------- | ----------- | | serviceId | String | 服务id | | imei | string | nbiot设备的身份码 | | type | int32 | 服务类型 1:同步 2:异步 | | serviceName | String | 服务名 | | retry | int32 | 重试次数 | | input | map[string]interface{} | 服务入参 | | output | map[string]interface{} | 服务出参 | | expiredTime | int64 | 过期时间戳 | | validTime | int64 | 有效时间戳 | | sendTime | int64 | 发送时间 | | createTime | int64 | 创建时间 | | sendStatus | int32 | 服务调用状态 0: 等待; 1:被取消;2:已发送; 3:过期;4:执行成功; 5:执行失败; 6:超时; | | failedCount | int32 | 执行失败次数 | | errMsg | string | 错误信息 |

Response

{
    "code": 0,
    "data": {
        "totalPage": 1,
        "pageSize": 100,
        "currentPage": 1,
        "totalCount": 1,
        "content": [
            {
                "errMsg": "",
                "type": 1,
                "serviceName": "RemoteOpenDoorSvc",
                "expiredTime": 1620643306000,
                "sendTime": 0,
                "output": null,
                "input": {
                    "Operation": 1
                },
                "failedCount": 0,
                "createTime": 1618454160708,
                "imei": "868474044790978",
                "validTime": 1618296906595,
                "sendStatus": 0,
                "serviceId": "5e7c1abb-3172-4a70-90e5-e9da753cf235",
                "retry": 5
            }
        ]
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

7.2.13 【nb设备离线服务调用】 根据设备imei获取所有服务调用列表(不分页)

功能描述:根据设备imei获取所有服务调用列表(不分页)

Get /api/v1/offlineservice/nb/list

Query:

Name Type Description Required
imei string nbiot设备的身份码 Yes
**cURL example:**

curl --location --request GET {URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb/list?accessKeyId=4EKha46hV011SHAu&imei=868474044790978' \ --header 'platform: 1' \ --header 'projectId: 559a2be0-aaaa-46a4-91c4-06dc7f6d39a1'


**Response data:**
Response    
| Name        | Type     | Description |
| ----------- | -------- | ----------- |
| serviceId   | String   | 服务id      |
| imei   | string   | nbiot设备的身份码      |
| type   |  int32  | 服务类型    1:同步 2:异步      |
| serviceName   | String   | 服务名      |
| retry   | int32   | 重试次数      |
| input   | map[string]interface{}   | 服务入参      |
| output   | map[string]interface{}   | 服务出参      |
| expiredTime   | int64   | 过期时间戳      |
| validTime   | int64   | 有效时间戳      |
| sendTime   | int64   | 发送时间      |
| createTime   | int64   | 创建时间      |
| sendStatus   | int32   | 服务调用状态     0: 等待; 1:被取消;2:已发送; 3:过期;4:执行成功; 5:执行失败; 6:超时; |
| failedCount   | int32   | 执行失败次数      |
| errMsg   | string   | 错误信息      |


**Response**

{ "data": [ { "serviceId": "5cac161ae13823c727b1f2a0", "type": 1, "imei": "123", "serviceName": "identifierName", "retry": 3, "input": {"in":"test"}, "output": {"out":"test"}, "createTime": 1554781722097, "validTime": 1554862042000, "expiredTime": 1554862042000, "sendTime": 0, "sendStatus": 0, "failedCount": 0, "errMsg":"failed..." } ], "success": true, "code": 0, "msg": null }





## 7.2.14  【nb设备离线服务调用】 批量删除服务调用

功能描述:批量删除服务调用

DELETE /api/v1/offlineservice/nb/list

**Query:**

|   Name    |   Type   | Description  | Required |
| :-------: | :------: | :----------- | -------- |
| serviceId | string[] | 服务ID的数组 | Yes      |

cURL example:

curl --location --request DELETE {URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb/list?accessKeyId=4EKha46hV011SHAu&serviceId=123,456' \
--header 'platform: 1' \
--header 'projectId: 559a2be0-aaaa-46a4-91c4-06dc7f6d39a1'

Response data: Response
true

Response

{
    "data": null,
    "success": true,
    "code": 0,
    "msg": null
}

7.2.15 【nb设备离线服务调用】 根据指定条件获取服务调用列表(不分页)

功能描述:根据指定条件获取服务调用列表(不分页)

GET /api/v1/offlineservice/nb/filter
**Body:**

|    Name     |   Type   | Description             | Required |
| :---------: | :------: | :---------------------- | -------- |
| currentTime |   long   | 当前时间                | Yes      |
|  imeiList   | string[] | imei列表               | Yes      |
| statusList  |  int[]   | 命令状态列表            | Yes      |

**Body example:**

{ "currentTime":1554862042000, "imeiList": [ "8ae48daf7163309a0171ee0575150010" ], "statusList": [0,1] }

**cURL example:**

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlinecmds/nb/filter?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&imei=cewvee' \ --header 'platform: 1' \ --header 'projectId: {projectId}'




**Response data:**
Response    
| Name        | Type     | Description |
| ----------- | -------- | ----------- |
| serviceId   | String   | 服务id      |
| imei   | string   | nbiot设备的身份码      |
| type   |  int32  | 服务类型    1:同步 2:异步      |
| serviceName   | String   | 服务名      |
| retry   | int32   | 重试次数      |
| input   | map[string]interface{}   | 服务入参      |
| output   | map[string]interface{}   | 服务出参      |
| expiredTime   | int64   | 过期时间戳      |
| validTime   | int64   | 有效时间戳      |
| sendTime   | int64   | 发送时间      |
| createTime   | int64   | 创建时间      |
| sendStatus   | int32   | 服务调用状态     0: 等待; 1:被取消;2:已发送; 3:过期;4:执行成功; 5:执行失败; 6:超时; |
| failedCount   | int32   | 执行失败次数      |
| errMsg   | string   | 错误信息      |


**Response**

{ "data": [ { "commandId": "5cac3699e13823f48566d52a", "type": 1, "imei": "123", "identifier": "test", "retry": 3, "mode": 0, "content": "{\n\n}", "createTime": 1554790041275, "validTime": 1554862042000, "expiredTime": 1554862042000, "sendTime": 0, "sendStatus": 0, "cmdResult": "", "failedCount": 0 }, { "commandId": "5cac161ae13823c727b1f2a0", "type": 0, "imei": "123", "identifier": "test", "retry": 3, "mode": 0, "content": "", "createTime": 1554781722097, "validTime": 1554862042000, "expiredTime": 1554862042000, "sendTime": 0, "sendStatus": 0, "cmdResult": "", "failedCount": 0 } ], "success": true, "code": 0, "msg": null }

7.2.16 【nb设备离线服务调用】 更新服务调用(增量更新)

功能描述:更新服务调用(增量更新)

PUT /api/v1/offlineservice/nb
**Body:**


|    Name     |  Type  | Description                                                  | Required |
| :---------: | :----: | :----------------------------------------------------------- | -------- |
|  serviceId  | string | 命令ID                                                       | Yes      |
|    retry    |  int   | [3-10]之间,表示失败重试次数(等待下一次设备更新或者上线)   | No      |
|  validTime  |  long  | 命令开始生效时间,大于当前时间,单位:毫秒                   | No      |
| expiredTime |  long  | 命令过期时间,必填且大于validTime,单位:毫秒                 | No      |

**Body example:**

{ "serviceId": "6dcd4c67-91d2-494d-9e9c-c5cb0fc64749", "retry":6, "validTime":1618294637285, "expiredTime":1619170213000 }


**cURL example:**

curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/offlineservice/nb?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \ --header 'platform: 1' \ --header 'projectId: {projectId}' \ --header 'Content-Type: application/json' \ --data-raw '{ "serviceId": "6dcd4c67-91d2-494d-9e9c-c5cb0fc64749", "retry":6, "validTime":1618294637285, "expiredTime":1619170213000 }'



**Response data:**

| Name        | Type   | Description    |
| :---------: | :----: | :------------: |
| serviceId   | String | 服务id |

**Response example:**

{ "code":0, "message":null, "success":true, "data":{"serviceId":"5cac3699e13823f48566d52a"} } ```

results matching ""

    No results matching ""